<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of soa2Logs
 *
 * @author dxx
 */

namespace app\common\model\log;

use think\Model;

class ReportUrlRecord extends Model {

    protected $table = 'report_url_record';
    protected $connection = ['database' => 'jooj_log'];
    
    /**
     * 添加记录
     * @param type $params
     */
    public function addRecord($params=[]){
        $data = [
            'type'=> "{$params['type']}",
            'date'=> "{$params['date']}",
            'add_ts'=>time(),
            'url'=>  "{$params['url']}"
        ];
            
        return $this->insertGetId($data);
    }
    
    
    public function getList($params=[]){
        return $this->where([
            'type'=>"{$params['type']}",
            'date'=>['between',["{$params['start_date']}","{$params['end_date']}"]],
        ])->select();
    }
    
}
